//
//  FivethChapterViewController.m
//  CoreAnimation
//
//  Created by 张国文 on 16/10/13.
//  Copyright © 2016年 hangzhouyijiyin. All rights reserved.
//

#import "FivethChapterViewController.h"
#import "CAShapeLayerViewController.h"
#import "CATextLayerViewController.h"
#import "CustomCATextLayerViewController.h"
#import "CATransformLayerViewController.h"
#import "CAGradientLayerViewController.h"
#import "CAReplicatorLayerViewController.h"
#import "CAScrollLayerViewController.h"
#import "CATiledLayerViewController.h"
#import "CAEmitterLayerViewController.h"
#import "CAEAGLLayerViewController.h"
#import "AVPlayerLayerViewController.h"

@interface FivethChapterViewController ()

@end

@implementation FivethChapterViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    
    UIButton *firstButton = [UIButton buttonWithType:UIButtonTypeCustom];
    firstButton.frame = CGRectMake(0, 20, 300, 50);
    [firstButton setTitle:@"CAShapeLayer" forState:UIControlStateNormal];
    [firstButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    firstButton.tag = 100;
    [firstButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:firstButton];
    
    UIButton *sectionButton = [UIButton buttonWithType:UIButtonTypeCustom];
    sectionButton.frame = CGRectMake(0, 70, 300, 50);
    [sectionButton setTitle:@"CATextLayer" forState:UIControlStateNormal];
    [sectionButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    sectionButton.tag = 101;
    [sectionButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:sectionButton];

    
    UIButton *thirdButton = [UIButton buttonWithType:UIButtonTypeCustom];
    thirdButton.frame = CGRectMake(0, 120, 300, 50);
    [thirdButton setTitle:@"运用CATextLayer自定义UILabel" forState:UIControlStateNormal];
    [thirdButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    thirdButton.tag = 102;
    [thirdButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:thirdButton];

    UIButton *fourthButton = [UIButton buttonWithType:UIButtonTypeCustom];
    fourthButton.frame = CGRectMake(0, 170, 300, 50);
    [fourthButton setTitle:@"CATransformLayer" forState:UIControlStateNormal];
    [fourthButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    fourthButton.tag = 103;
    [fourthButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:fourthButton];

    UIButton *fivethButton = [UIButton buttonWithType:UIButtonTypeCustom];
    fivethButton.frame = CGRectMake(0, 220, 300, 50);
    [fivethButton setTitle:@"CAGradientLayer" forState:UIControlStateNormal];
    [fivethButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    fivethButton.tag = 104;
    [fivethButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:fivethButton];
//
    UIButton *sixthButton = [UIButton buttonWithType:UIButtonTypeCustom];
    sixthButton.frame = CGRectMake(0, 270, 300, 50);
    [sixthButton setTitle:@"CAReplicatorLayer" forState:UIControlStateNormal];
    [sixthButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    sixthButton.tag = 105;
    [sixthButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:sixthButton];
//
    UIButton *sevenButton = [UIButton buttonWithType:UIButtonTypeCustom];
    sevenButton.frame = CGRectMake(0, 320, 300, 50);
    [sevenButton setTitle:@"CAScrollLayer" forState:UIControlStateNormal];
    [sevenButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    sevenButton.tag = 106;
    [sevenButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:sevenButton];
    
    UIButton *eightButton = [UIButton buttonWithType:UIButtonTypeCustom];
    eightButton.frame = CGRectMake(0, 370, 300, 50);
    [eightButton setTitle:@"CATiledLayer" forState:UIControlStateNormal];
    [eightButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    eightButton.tag = 107;
    [eightButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:eightButton];
    
    UIButton *ninethButton = [UIButton buttonWithType:UIButtonTypeCustom];
    ninethButton.frame = CGRectMake(0, 420, 300, 50);
    [ninethButton setTitle:@"CAEmitterLayer" forState:UIControlStateNormal];
    [ninethButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    ninethButton.tag = 108;
    [ninethButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:ninethButton];
    
    UIButton *tenthButton = [UIButton buttonWithType:UIButtonTypeCustom];
    tenthButton.frame = CGRectMake(0, 470, 300, 50);
    [tenthButton setTitle:@"CAEAGLLayer和滤镜" forState:UIControlStateNormal];
    [tenthButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    tenthButton.tag = 109;
    [tenthButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:tenthButton];
    
    UIButton *elevenButton = [UIButton buttonWithType:UIButtonTypeCustom];
    elevenButton.frame = CGRectMake(0, 520, 300, 50);
    [elevenButton setTitle:@"AVPlayerLayer" forState:UIControlStateNormal];
    [elevenButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    elevenButton.tag = 110;
    [elevenButton addTarget:self action:@selector(clickJump:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:elevenButton];
}

- (void)clickJump:(UIButton *)button
{
    switch (button.tag) {
        case 100:
        {
            CAShapeLayerViewController *caShapeLayerVC = [[CAShapeLayerViewController alloc] init];
            [self.navigationController pushViewController:caShapeLayerVC animated:YES];
            break;
        }
        case 101:
        {
            CATextLayerViewController *caTextLayerVC = [[CATextLayerViewController alloc] init];
            [self.navigationController pushViewController:caTextLayerVC animated:YES];
            break;
        }
        case 102:
        {
            CustomCATextLayerViewController *customCATextLayerVC = [[CustomCATextLayerViewController alloc] init];
            [self.navigationController pushViewController:customCATextLayerVC animated:YES];
            break;
        }
        case 103:
        {
            CATransformLayerViewController *caTransformLayerVC = [[CATransformLayerViewController alloc] init];
            [self presentViewController:caTransformLayerVC animated:YES completion:nil];
            break;
        }
        case 104:
        {
            CAGradientLayerViewController *caGradientLayer = [[CAGradientLayerViewController alloc] init];
            [self.navigationController pushViewController:caGradientLayer animated:YES];
            break;
        }
        case 105:
        {
            CAReplicatorLayerViewController *caReplicatorLayerVC = [[CAReplicatorLayerViewController alloc] init];
            [self presentViewController:caReplicatorLayerVC animated:YES completion:nil];
            break;
        }
        case 106:
        {
            CAScrollLayerViewController *caScrollLayerVC = [[CAScrollLayerViewController alloc] init];
            [self.navigationController pushViewController:caScrollLayerVC animated:YES];
            break;
        }
            case 107:
        {
            CATiledLayerViewController *caTiedLayerVC = [[CATiledLayerViewController alloc] init];
            [self.navigationController pushViewController:caTiedLayerVC animated:YES];
            break;
        }
            case 108:
        {
            CAEmitterLayerViewController *caEmitterLayerVC = [[CAEmitterLayerViewController alloc] init];
            [self presentViewController:caEmitterLayerVC animated:YES completion:nil];
            break;
        }
            case 109:
        {
            CAEAGLLayerViewController *caEAGLLayerVC = [[CAEAGLLayerViewController alloc] init];
            [self.navigationController pushViewController:caEAGLLayerVC animated:YES];
            break;
        }
            case 110:
        {
            AVPlayerLayerViewController *avPlayerLayerVC = [[AVPlayerLayerViewController alloc] init];
            [self.navigationController pushViewController:avPlayerLayerVC animated:YES];
            break;
        }
        default:
            break;
    }
}


@end
